package com.itheima.reggie.common;

/**
 * @author mff
 * @date 2022/6/7 20:36
 * @mood happy
 */
/*
* 基于threadLocal的封装，饿汉式
*/
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }

    public static Long getCurrentId(){
        return threadLocal.get();
    }

    public static void removeCurrentId(){
        threadLocal.remove();
    }

}
